<?php

namespace App\Models\goods;

use App\Models\base\traits\HasGoods;
use App\Models\base\traits\ImgTrait;
use Illuminate\Database\Eloquent\Model;




/**
 * App\Models\goods\ShopCar
 *
 * @property int $id
 * @property int $user_id 用户ID
 * @property int $goods_id
 * @property string $type_name 类型名
 * @property int $spec_id 规格ID
 * @property int $checked 是否选中
 * @property int $num
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @property-read \App\Models\goods\Goods $goods
 * @property-read \App\Models\goods\GoodsSpec $spec
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\goods\ShopCar newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\goods\ShopCar newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\goods\ShopCar query()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\goods\ShopCar whereChecked($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\goods\ShopCar whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\goods\ShopCar whereGoodsId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\goods\ShopCar whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\goods\ShopCar whereNum($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\goods\ShopCar whereSpecId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\goods\ShopCar whereTypeName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\goods\ShopCar whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\goods\ShopCar whereUserId($value)
 * @mixin \Eloquent
 */
class ShopCar extends Model
{
    use HasGoods;

    protected $fillable = [
        'user_id',
        'goods_id',
        'type_name',
        'spec_id',
        'num',
    ];



    public function spec()
    {
        return $this->hasOne(GoodsSpec::class, 'id','spec_id');
    }
}
